<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Rainboy</title>
    <link rel="shortcut icon" type="image/x-icon" href="https://ww1.sinaimg.cn/large/007i4MEmgy1fzgcznqhpqj3020020mwz.jpg">
    <link href="https://fonts.font.im/css?family=Baloo+Bhai" rel="stylesheet">
    <style>
html,body,.container {
    font-family: 'Baloo Bhai', cursive;
    padding:0;
    width:100%;
    height:100%;
    background:#000;
    overflow:hidden;

}
.container img {
    position:absolute;
    bottom:0;
    left:10px;
}


.hidden {
  opacity:0;
}
.console-container {
 
  font-size:3em;
  text-align:center;
  height:200px;
  width:80%;
  display:block;
  position:absolute;
  color:white;
  top:0;
  bottom:0;
  left:0;
  right:0;
  margin:auto;
}
.console-underscore {
   display:inline-block;
  position:relative;
  top:-0.14em;
  left:10px;
}
    </style>
</head>
<body>
    <div class="container">

        <div class='console-container'><span id='text'></span><div class='console-underscore' id='console'>&#95;</div></div>
        <img src="https://ww1.sinaimg.cn/large/007i4MEmgy1fzgc85symeg307x0c0767.jpg" alt="">

        <script>
// function([string1, string2],target id,[color1,color2])    
consoleText(['Hello World.', 'I,Rainboy ₍₍٩( ᐛ )۶₎₎♪', 'What are you looking for ?'], 'text',['#f90','rebeccapurple','lightblue']);

function consoleText(words, id, colors) {
  if (colors === undefined) colors = ['#fff'];
  var visible = true;
  var con = document.getElementById('console');
  var letterCount = 1;
  var x = 1;
  var waiting = false;
  var target = document.getElementById(id)
  target.setAttribute('style', 'color:' + colors[0])
  window.setInterval(function() {

    if (letterCount === 0 && waiting === false) {
      waiting = true;
      target.innerHTML = words[0].substring(0, letterCount)
      window.setTimeout(function() {
        var usedColor = colors.shift();
        colors.push(usedColor);
        var usedWord = words.shift();
        words.push(usedWord);
        x = 1;
        target.setAttribute('style', 'color:' + colors[0])
        letterCount += x;
        waiting = false;
      }, 1000)
    } else if (letterCount === words[0].length + 1 && waiting === false) {
      waiting = true;
      window.setTimeout(function() {
        x = -1;
        letterCount += x;
        waiting = false;
      }, 1000)
    } else if (waiting === false) {
      target.innerHTML = words[0].substring(0, letterCount)
      letterCount += x;
    }
  }, 120)
  window.setInterval(function() {
    if (visible === true) {
      con.className = 'console-underscore hidden'
      visible = false;

    } else {
      con.className = 'console-underscore'

      visible = true;
    }
  }, 400)
}
        </script>
    </div>
</body>
</html>
